<template>
<div class="content">
  <Form ref="formInline" :model="formInline" :label-width="70">
    <FormItem label="用户名">
      <Input v-model="formInline.username" placeholder="用户名"></Input>
    </FormItem>
    <FormItem label="真实姓名">
      <Input v-model="formInline.realName" placeholder="真实姓名"></Input>
    </FormItem>
    <!-- <FormItem label="密码">
      <Input v-model="formInline.password" placeholder="密码"></Input>
    </FormItem> -->
    <FormItem label="手机号码">
      <Input v-model="formInline.mobile" placeholder="手机号码"></Input>
    </FormItem>
    <FormItem label="固定电话">
      <Input v-model="formInline.telephone" placeholder="固定电话"></Input>
    </FormItem>
    <FormItem label="电子邮箱">
      <Input v-model="formInline.email" placeholder="电子邮箱"></Input>
    </FormItem>
    <FormItem>
      <Button type="primary" @click="handleSubmit('formInline')">确定</Button>
    </FormItem>
  </Form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formInline: {
        createTime: "",
        email: "",
        id: "",
        mobile: "",
        password: "",
        realName: "",
        telephone: "",
        username: ""
      }
    };
  },
  mounted() {
    this.initData();
  },
  methods: {
    initData() {
      this.loading = true;
      this.$http
        .post("/api/auth/sysuser/doGetUser", {
          id: localStorage.getItem("userId")
        })
        .then(res => {
          this.data1 = res.retBody;
          this.formInline.email = this.data1.email;
          this.formInline.id = this.data1.id;
          this.formInline.mobile = this.data1.mobile;
          //this.formInline.password = this.data1[0].password;
          this.formInline.realName = this.data1.realName;
          this.formInline.telephone = this.data1.telephone;
          this.formInline.username = this.data1.username;
        });
    },
    handleSubmit(name) {
      this.$http.post("/api/auth/sysuser/doMod", this.formInline).then(res => {
        console.log(res);
        if (res.retHead.code == "0000000") {
          this.$Message.success({
            top: 100,
            duration: 1,
            content: res.retHead.message
          });
        } else {
          this.$Message.warning({
            top: 100,
            duration: 1,
            content: res.retHead.message
          });
        }
        this.initData();
      });
    }
  }
};
</script>